package leetcode;

import com.sun.source.doctree.SeeTree;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * @author Retain
 * @date 2021/9/7 19:29
 */
public class Baidu {
    public static void main(String[] args) throws Exception{
        q3();
    }

    public static void q1() throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int[] s = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int n = s[0];
        int k = s[1];
        int[][] bit = new int[n][n];
        for (int i = 0; i < n; i++) {
            bit[i] = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        }

        for (int i = 0; i < n; i++) {
                for (int m = 0; m < k; m++) {
                    for (int j = 0; j < n; j++) {
                        for (int l = 0; l < k; l++) {
                            System.out.print(bit[i][j] + " ");
                        }
                    }
                System.out.println();
            }
        }
    }

    public static void q2() throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] nums = new String[n];
        for (int i = 0; i < n; i++) {
            nums[i] = br.readLine();
        }

        for (String num : nums) {
            System.out.println(getMax(num));
        }
    }

    public static String getMax(String num) {
        char[] chars = num.toCharArray();
        StringBuilder sb = new StringBuilder();
        boolean flag = false;
        for (int i = 0; i < chars.length; i++) {

            if (flag) {
                sb.append('3');
                continue;
            }
            if (chars[i] > '3') {
                sb.append('3');
                flag = true;
            } else {
                sb.append(chars[i]);
            }
        }
        return sb.toString();
    }

    public static void q3() throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int[] line = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int n = line[0];
        int k = line[1];
        String s = br.readLine();
        Set<Character> set = new HashSet<Character>();
        int[] pre = new int[s.length() + 1];
        char[] chars = s.toCharArray();
        int[][] dp = new int[n][n];

        for (int i = 0; i < s.length(); i++) {
            if (set.add(chars[i])) {
                pre[i + 1] = pre[i] + 1;
            } else {
                pre[i + 1] = pre[i];
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = i; j < n; j++) {
                dp[i][j] = pre[j + 1] - pre[i];
            }
        }

        List<Integer> ints = new ArrayList<Integer>();
        int left = 0;
        int right = 1;
        while (right < s.length()) {
            while (right < s.length() && chars[right] == chars[right - 1]) {
                right++;
            }
            if (right - left > 1) {
                ints.add(right - left + 1);
            }
            left = right;
            right++;
        }
    }
}
